home *** CD-ROM | disk | FTP | other *** search
/ Champak 142 / Volume 142 Oct 17 2011 - Damaged.iso / Games / operation-graduates.swf / scripts / frame_41 / DoAction_18.as < prev    next >
Text File  |  2011-10-17  |  3KB  |  109 lines

  1. function createHUD()
  2. {
  3.    createEmptyMovieClip("HUD",HUDDepth);
  4.    createLives();
  5.    createScore();
  6. }
  7. function createLives()
  8. {
  9.    HUD.attachMovie("lifeThing","lives",11,{_x:595,_y:5});
  10.    i = 0;
  11.    while(i < theHull.lives)
  12.    {
  13.       HUD.lives.attachMovie("lifeHeart","lifeHeart" + i,i,{_x:i * -24 - 48});
  14.       i++;
  15.    }
  16. }
  17. function addLife()
  18. {
  19.    if(theHull.lives < 12)
  20.    {
  21.       theHull.lives = theHull.lives + 1;
  22.       i = 0;
  23.       while(i < theHull.lives)
  24.       {
  25.          HUD.lives.attachMovie("lifeHeart","lifeHeart" + i,i,{_x:i * -24 - 48});
  26.          i++;
  27.       }
  28.    }
  29. }
  30. function createScore()
  31. {
  32.    var tempScore = theHull.score;
  33.    var tempDigit;
  34.    var tempPow;
  35.    extraLifeThing = Math.floor(theHull.score / 10000);
  36.    i = 6;
  37.    while(i >= 0)
  38.    {
  39.       tempPow = Math.pow(10,i);
  40.       tempDigit = Math.floor(tempScore / tempPow);
  41.       HUD.attachMovie("number","dig" + i,i,{_x:i * -10 + 66,_y:3});
  42.       eval("HUD.dig" + i).gotoAndStop(tempDigit + 1);
  43.       tempScore %= tempPow;
  44.       i--;
  45.    }
  46. }
  47. function addScore(newPoints)
  48. {
  49.    var tempScore = theHull.score += newPoints;
  50.    var tempDigit;
  51.    var tempPow;
  52.    i = 6;
  53.    while(i >= 0)
  54.    {
  55.       tempPow = Math.pow(10,i);
  56.       tempDigit = Math.floor(tempScore / tempPow);
  57.       eval("HUD.dig" + i).gotoAndStop(tempDigit + 1);
  58.       tempScore %= tempPow;
  59.       i--;
  60.    }
  61. }
  62. function doLetterbox()
  63. {
  64.    var _loc1_ = this;
  65.    createEmptyMovieClip("letterbox",5500);
  66.    letterbox.attachMovie("letterboxT","top",1,{_x:0,_y:0});
  67.    letterbox.attachMovie("letterboxB","bottom",2,{_x:0,_y:400});
  68.    letterbox.t = 0;
  69.    letterbox.s = 0;
  70.    letterbox.c = 30;
  71.    letterbox.d = 5;
  72.    letterbox.onEnterFrame = function()
  73.    {
  74.       var _loc1_ = this;
  75.       if(_loc1_.t < _loc1_.d)
  76.       {
  77.          _loc1_.t = _loc1_.t + 1;
  78.          _loc1_.top._height = Math.easeInQuad(_loc1_.t,_loc1_.s,_loc1_.c,_loc1_.d);
  79.          _loc1_.bottom._height = Math.easeInQuad(_loc1_.t,_loc1_.s,_loc1_.c,_loc1_.d);
  80.          if(_loc1_.t == _loc1_.d)
  81.          {
  82.             _loc1_.onEnterFrame = null;
  83.          }
  84.       }
  85.    };
  86. }
  87. function undoLetterbox()
  88. {
  89.    var _loc1_ = this;
  90.    letterbox.t = 0;
  91.    letterbox.s = 30;
  92.    letterbox.c = -30;
  93.    letterbox.d = 5;
  94.    letterbox.onEnterFrame = function()
  95.    {
  96.       var _loc1_ = this;
  97.       if(_loc1_.t < _loc1_.d)
  98.       {
  99.          _loc1_.t = _loc1_.t + 1;
  100.          _loc1_.top._height = Math.easeInQuad(_loc1_.t,_loc1_.s,_loc1_.c,_loc1_.d);
  101.          _loc1_.bottom._height = Math.easeInQuad(_loc1_.t,_loc1_.s,_loc1_.c,_loc1_.d);
  102.       }
  103.       if(_loc1_.t == _loc1_.d)
  104.       {
  105.          _loc1_.removeMovieClip();
  106.       }
  107.    };
  108. }
  109.